<html>
<head><meta charset="utf-8"><title>address-space (ptr, ref) · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html">address-space (ptr, ref)</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="179423652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179423652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179423652">(Oct 30 2019 at 11:54)</a>:</h4>
<p>Hi all! I'm working on full support address-spaces now.<br>
So I'm stuck on limited size  of Ty. <strong>Why it's limited to 32bit?</strong><br>
See:  librustc/ty/mod.rs @ line 506 <code>static_assert_size!(TyS&lt;'_&gt;, 32);</code></p>
<p>It's blocking me to add address_space field into RawPtr for example.<br>
(And I can't use const-generics because it's really incomplete and unstable yet)</p>



<a name="179423817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179423817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179423817">(Oct 30 2019 at 11:56)</a>:</h4>
<p>It's limited because the size of Ty should be kept small to decrease memory usage and increase speed</p>



<a name="179424011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179424011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179424011">(Oct 30 2019 at 11:59)</a>:</h4>
<p>So now I have no idea how to impl it without extending that size. Any suggestions, ideas?</p>



<a name="179424134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179424134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179424134">(Oct 30 2019 at 12:00)</a>:</h4>
<p>Can I increase size from 32 to 40? Is it will be ok?</p>



<a name="179424167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179424167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179424167">(Oct 30 2019 at 12:00)</a>:</h4>
<p>Well, if it's required, obviously we _can_, it's just likely bad for perf</p>



<a name="179424330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179424330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179424330">(Oct 30 2019 at 12:03)</a>:</h4>
<p>I think I've seen some other existing work in this area, maybe it's been by you, not sure</p>



<a name="179424347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179424347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179424347">(Oct 30 2019 at 12:03)</a>:</h4>
<p>I would try and touch base with <span class="user-mention" data-user-id="119009">@eddyb</span> (though they can be hard to reach, super busy) on this before doing much</p>



<a name="179427017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179427017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179427017">(Oct 30 2019 at 12:42)</a>:</h4>
<p><span class="user-mention" data-user-id="246528">@Alex Koz.</span> I'm sorry, but it's unlikely that you could upstream such a change without an RFC</p>



<a name="179427049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179427049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179427049">(Oct 30 2019 at 12:43)</a>:</h4>
<p>and I'm against landing anything invasive - there's already been an attempt and they didn't want to shrink it down to the minimum necessary to function</p>



<a name="179427082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179427082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179427082">(Oct 30 2019 at 12:43)</a>:</h4>
<p>and that's all pretty much hidden from the user, it would be hard to convince people that make the typesystem more complex is worth it</p>



<a name="179427141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179427141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179427141">(Oct 30 2019 at 12:44)</a>:</h4>
<p><span class="user-mention" data-user-id="246528">@Alex Koz.</span> you could, however, use <code>const</code> generics and a lang item, to experiment with some of this, and it would be less invasive</p>



<a name="179427163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179427163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179427163">(Oct 30 2019 at 12:44)</a>:</h4>
<p>maybe intrinsics to do the non-default-address-space operations</p>



<a name="179436860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179436860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179436860">(Oct 30 2019 at 14:24)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  Thanks for answer. I cannot use intrinsics because there's should be fn-params initially. For example something like this:</p>
<div class="codehilite"><pre><span></span>const ADDR_SPACE_FOO = 2;
type Color = [u32; 4]
extern &quot;some-abi&quot; fn my_compute_shader(buffer: Buf&lt;Color, ADDR_SPACE_FOO&gt;) { ... }
</pre></div>



<a name="179437544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179437544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179437544">(Oct 30 2019 at 14:31)</a>:</h4>
<blockquote>
<p>I'm sorry, but it's unlikely that you could upstream such a change without an RFC</p>
</blockquote>
<p>Thanks, I know. Firstly I should try and off course I'll write an RFC :)</p>



<a name="179441970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179441970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179441970">(Oct 30 2019 at 15:12)</a>:</h4>
<p>an intrinsic like that would work I think</p>



<a name="179441990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179441990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179441990">(Oct 30 2019 at 15:12)</a>:</h4>
<p>although I'm not sure what you mean</p>



<a name="179447481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179447481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179447481">(Oct 30 2019 at 16:00)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> ,</p>
<p>I mean I need possibility  somehow describe address-space for input args of function. <br>
E.g.: if I wanna addrspace=42 for <code>ptr</code> in <code>fn foo(ptr: *mut u128)</code>, so in llvm's IR <code>ptr</code> should be <code>u128 addrspace(42)*</code> .</p>
<p>So I have following options how to impl this:<br>
- wrap type of <code>ptr</code> into lang-item something like <code>AddressedPtr &lt;T, const ADDR_SPACE: u32&gt;</code> and later evaluate constant in codegen;<br>
- param-attr like <code>fn foo(    #[addrspace(42)]    ptr: *mut u128)</code> and wrap type and eval (see previous option);<br>
- hack syntax, add something terrible ptr-syntax extension like <code>*&lt;42&gt;mut u128</code> or <code>*.42 mut u128</code> (really bad option).</p>
<p>What I have missed?</p>
<p>P.S: Sorry, my English isn't so cool. It's not native for me (yet).</p>



<a name="179449068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179449068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179449068">(Oct 30 2019 at 16:14)</a>:</h4>
<p>For better explanation,<br>
- Address space is an attr of pointer<br>
- In low-level and compile-time, address space for various targets have various usage. For example in the AMDGPU it used for mapping to various physical memory "parts", but in Apple's Metal also for indicate mutability.<br>
- For GPU-target (as minimum) we should expose API for create addresspace-ed pointers to user. I think it should be type-wrapper with const-generic in the libcore as I told before.</p>



<a name="179449210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179449210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179449210">(Oct 30 2019 at 16:15)</a>:</h4>
<blockquote>
<p>- wrap type of <code>ptr</code> into lang-item something like <code>AddressedPtr &lt;T, const ADDR_SPACE: u32&gt;</code> and later evaluate constant in codegen;</p>
</blockquote>
<p>this is what I was suggesting btw</p>



<a name="179449252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179449252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179449252">(Oct 30 2019 at 16:16)</a>:</h4>
<p>it avoids needing to change the typesystem</p>



<a name="179449569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179449569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179449569">(Oct 30 2019 at 16:19)</a>:</h4>
<p>Thanks! I think so.</p>



<a name="179528525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179528525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179528525">(Oct 31 2019 at 13:00)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> May you help me with a little stuck? I added lang item in <code>librustc/middle/lang_items.rs</code> : <code>language_item_table!</code></p>
<p><code>AddrspaceLangItem,           "addrspace",          addrspace,               Target::Struct;</code></p>
<p>but anyway always getting error when libcore compilation: <code>definition of an unknown language item: addrspace</code>.<br>
What I missed?</p>



<a name="179528584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179528584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179528584">(Oct 31 2019 at 13:01)</a>:</h4>
<p>you need to have <code>#[cfg(not(bootstrap))]</code> on it</p>



<a name="179528604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179528604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179528604">(Oct 31 2019 at 13:01)</a>:</h4>
<p>since the beta compiler doesn't know about it yet</p>



<a name="179528654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179528654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179528654">(Oct 31 2019 at 13:02)</a>:</h4>
<p>I agree with <span class="user-mention" data-user-id="119009">@eddyb</span> that this would require an RFC -- and in particular I'd like to understand better the motivation</p>



<a name="179528720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179528720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179528720">(Oct 31 2019 at 13:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> ignoring x86_16, which idk if anyone is working on, this tends to be limited to GPUs, which are designed to have N distinct memory spaces and I'm not even sure there's a way to have an unified pointer at all (like you can have a far pointer on x86_16)</p>



<a name="179528782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179528782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179528782">(Oct 31 2019 at 13:04)</a>:</h4>
<p>while compiling Rust to run on GPUs is cool, it's also... complicated</p>



<a name="179528818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179528818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179528818">(Oct 31 2019 at 13:04)</a>:</h4>
<p>I'd prefer us have the current typesystem and only add special types (or even just intrinsics in <code>{core,std}::arch</code>) for the "non-default" address spaces, but it may not be workable</p>



<a name="179528985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179528985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179528985">(Oct 31 2019 at 13:06)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> note that this is not about Harvard architectures (like AVR, I think? or a different one we support), which we already support by always keeping data pointers and <code>fn</code> pointers distinct during codegen (this is not that hard since the typesystem already distinguishes between them)</p>



<a name="179529056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529056">(Oct 31 2019 at 13:07)</a>:</h4>
<p>and besides, data pointers use <code>load</code>/<code>store</code>, <code>fn</code> pointers use <code>call</code>, they're disjoint in their uses and the difference can be handled there trivially</p>



<a name="179529179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529179">(Oct 31 2019 at 13:08)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> on top of that, all attempts I've seen at adding multiple data addrspaces to Rust (including from <span class="user-mention" data-user-id="246528">@Alex Koz.</span>) explicitly mention GPUs</p>



<a name="179529347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529347">(Oct 31 2019 at 13:10)</a>:</h4>
<p>GPUs are the primary case where I'm familiar with address spaces. At $dayjob, we need to consider different address spaces in Clang for targeting GPUs (through OpenCL).</p>



<a name="179529464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529464">(Oct 31 2019 at 13:12)</a>:</h4>
<p>For the uses cases I'm familiar with specifically (and I'm by no means an expert in this stuff, but I do have some interest and would like to see Rust be usable in this space), address spaces of pointers are typically inferred during compilation.</p>



<a name="179529492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529492">(Oct 31 2019 at 13:12)</a>:</h4>
<p>Though some projects I'm aware of (that also target OpenCL) will use OpenCL 2.0's generic space (<a href="https://software.intel.com/en-us/articles/the-generic-address-space-in-opencl-20" target="_blank" title="https://software.intel.com/en-us/articles/the-generic-address-space-in-opencl-20">https://software.intel.com/en-us/articles/the-generic-address-space-in-opencl-20</a>) exclusively and leave all inference to the OpenCL runtime.</p>



<a name="179529552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529552">(Oct 31 2019 at 13:13)</a>:</h4>
<p>ooooh I'd prefer that if it's possible for LLVM to do it</p>



<a name="179529561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529561">(Oct 31 2019 at 13:13)</a>:</h4>
<p>(i.e. if we don't have to do it in rustc)</p>



<a name="179529625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529625">(Oct 31 2019 at 13:14)</a>:</h4>
<p>That's not something that LLVM has currently, but I know people discussing the possibility (commercially, unlikely to ever be unstreamed).</p>



<a name="179529645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529645">(Oct 31 2019 at 13:14)</a>:</h4>
<p><span aria-label="scream" class="emoji emoji-1f631" role="img" title="scream">:scream:</span></p>



<a name="179529681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529681">(Oct 31 2019 at 13:15)</a>:</h4>
<p>so who implements OpenCL 2 and how?!</p>



<a name="179529701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529701">(Oct 31 2019 at 13:15)</a>:</h4>
<p>Sometimes you do need to specify it in user code though, I've seen attributes in Clang (something like <code>__attribute__((address_space(3))</code>) used or types that are constructed like <code>Option</code>, but you have some <code>GlobalAddrSpacePointer::new(/* some ptr type*/)</code> which is either <code>None</code> or <code>Some(/* ptr */)</code> if that pointer was in the global address space (obviously using some ugly non-algebraic-data-type in C++).</p>



<a name="179529739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529739">(Oct 31 2019 at 13:16)</a>:</h4>
<p>Intel's SYCL implementation (<a href="https://github.com/intel/llvm" target="_blank" title="https://github.com/intel/llvm">https://github.com/intel/llvm</a>) uses the generic address space for everything and then their OpenCL runtime does the inference (so they are OpenCL 2.0 only).</p>



<a name="179529813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529813">(Oct 31 2019 at 13:16)</a>:</h4>
<p>My employer's SYCL implementation does the address space inference in Clang, and so supports OpenCL &lt;2.0 too.</p>



<a name="179529824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529824">(Oct 31 2019 at 13:17)</a>:</h4>
<p>(which is valuable, because some specialized hardware won't be able to support generic address spaces)</p>



<a name="179529907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179529907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179529907">(Oct 31 2019 at 13:18)</a>:</h4>
<p>I don't know enough about this stuff from a end-user perspective (or implementer's perspective) to have a strong opinion on how much this type of detail should be surfaced to the user, or how possible it is to do it all without the user needing to care.</p>



<a name="179530306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179530306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179530306">(Oct 31 2019 at 13:23)</a>:</h4>
<p>Intel's Compute Runtime (<a href="https://github.com/intel/compute-runtime" target="_blank" title="https://github.com/intel/compute-runtime">https://github.com/intel/compute-runtime</a>) is an open-source implementation of OpenCL 2.1 for their integrated graphics hardware.</p>



<a name="179530324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179530324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179530324">(Oct 31 2019 at 13:23)</a>:</h4>
<p>@eddyb:</p>
<blockquote>
<p>you need to have #[cfg(not(bootstrap))] on it</p>
</blockquote>
<p>Maybe I'm stupid more then I knew but it's not working. Also <code>#[cfg_attr(not(bootstrap), lang = "addrspace")]</code> too. Same error.<br>
I added lang-item into the core lib, not in std.</p>



<a name="179530330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179530330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179530330">(Oct 31 2019 at 13:23)</a>:</h4>
<p>I assume (again, I'm not <em>that</em> familiar with this stuff) that it does address space inference to support generic address spaces.</p>



<a name="179530420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179530420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179530420">(Oct 31 2019 at 13:24)</a>:</h4>
<p><span class="user-mention" data-user-id="246528">@Alex Koz.</span> can you search your copy of libcore for the word <code>bootstrap</code>?</p>



<a name="179530445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179530445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179530445">(Oct 31 2019 at 13:25)</a>:</h4>
<p>if you're not up to date it might be named something else, there were some issues for a bit</p>



<a name="179530469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179530469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179530469">(Oct 31 2019 at 13:25)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="246528">Alex Koz.</span> can you search libcore for the word <code>bootstrap</code>?</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/blob/9285d401a6070094747465962bc49969b93e14c5/src/libcore/panic.rs#L170" target="_blank" title="https://github.com/rust-lang/rust/blob/9285d401a6070094747465962bc49969b93e14c5/src/libcore/panic.rs#L170">Here's an example</a> on tip right now.</p>



<a name="179530626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179530626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179530626">(Oct 31 2019 at 13:27)</a>:</h4>
<p>Another example of address-spaces - AMDGPU target. There is various distinctions and ptr-sizes for each space. Also see mem-spaces.<br>
<a href="https://llvm.org/docs/AMDGPUUsage.html#amdgpu-address-space-mapping-table" target="_blank" title="https://llvm.org/docs/AMDGPUUsage.html#amdgpu-address-space-mapping-table">https://llvm.org/docs/AMDGPUUsage.html#amdgpu-address-space-mapping-table</a></p>



<a name="179530758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179530758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179530758">(Oct 31 2019 at 13:29)</a>:</h4>
<p><span class="user-mention" data-user-id="116107">@davidtwco</span> it was named something else for a while, is why I'm asking</p>



<a name="179530774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179530774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> davidtwco <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179530774">(Oct 31 2019 at 13:29)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116107">davidtwco</span> it was named something else for a while, is why I'm asking</p>
</blockquote>
<p>Yeah, I remember.</p>



<a name="179530785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179530785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179530785">(Oct 31 2019 at 13:29)</a>:</h4>
<p><span class="user-mention" data-user-id="246528">@Alex Koz.</span> that's not a different example, that's the same example I gave: GPUs</p>



<a name="179531041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531041">(Oct 31 2019 at 13:32)</a>:</h4>
<p><a href="/user_uploads/4715/L-EAWFoYA2NkhZVV78ymmwLx/Screenshot-2019-10-31-at-16.32.01.png" target="_blank" title="Screenshot-2019-10-31-at-16.32.01.png">Screenshot-2019-10-31-at-16.32.01.png</a>  :(</p>
<div class="message_inline_image"><a href="/user_uploads/4715/L-EAWFoYA2NkhZVV78ymmwLx/Screenshot-2019-10-31-at-16.32.01.png" target="_blank" title="Screenshot-2019-10-31-at-16.32.01.png"><img src="/user_uploads/4715/L-EAWFoYA2NkhZVV78ymmwLx/Screenshot-2019-10-31-at-16.32.01.png"></a></div>



<a name="179531117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531117">(Oct 31 2019 at 13:33)</a>:</h4>
<p><span class="user-mention" data-user-id="246528">@Alex Koz.</span> did you set anything in <code>config.toml</code>?</p>



<a name="179531216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531216">(Oct 31 2019 at 13:34)</a>:</h4>
<p><span class="user-mention" data-user-id="246528">@Alex Koz.</span> also, can you grep <code>src/libcore</code> in your checkout for <code>bootstrap</code>?</p>



<a name="179531254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531254">(Oct 31 2019 at 13:34)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>   Yes but there's nothing about lang-items.</p>



<a name="179531312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531312">(Oct 31 2019 at 13:35)</a>:</h4>
<p><span class="user-mention" data-user-id="246528">@Alex Koz.</span> doesn't matter, for both of my questions</p>



<a name="179531369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531369">(Oct 31 2019 at 13:36)</a>:</h4>
<p>for <code>config.toml</code>, it's possible you're not building stage0 with the beta compiler, and for the grep thing it's to confirm that the cfg flag is indeed named <code>bootstrap</code> for you</p>



<a name="179531411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531411">(Oct 31 2019 at 13:36)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> thanks -- I think this is a good and interesting case -- I'd like to enable <em>exploration</em> around GPUs (including tinkering with address spaces) but in a way where we give very low commitment</p>



<a name="179531422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531422">(Oct 31 2019 at 13:36)</a>:</h4>
<p>(and I agree i'd prefer to avoid invasive changes)</p>



<a name="179531479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531479">(Oct 31 2019 at 13:37)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> Found just my <code>#[cfg_attr(not(bootstrap), lang = "addrspace")]</code>. I'm on the not latest commit - mb. problem in it...</p>



<a name="179531609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531609">(Oct 31 2019 at 13:38)</a>:</h4>
<p>yeah, right now there are several uses of <code>bootstrap</code>, so if you don't see any others, you might be on one of the versions where it was named something hacky to bypass a bug</p>



<a name="179531668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531668">(Oct 31 2019 at 13:39)</a>:</h4>
<p>O! I understood. Thanks a lot! :D</p>



<a name="179531997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179531997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179531997">(Oct 31 2019 at 13:43)</a>:</h4>
<blockquote>
<p>@nikomatsakis : (and I agree i'd prefer to avoid invasive changes)</p>
</blockquote>
<p>Sorry, I have no see any way to impl it without changes of RawPtr structure to store the specified  address space.</p>
<p>But maybe I can create one more extra context where will be stored address space for each def?...</p>



<a name="179532025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179532025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179532025">(Oct 31 2019 at 13:44)</a>:</h4>
<p>Also same for Ref but more complex.</p>



<a name="179532289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179532289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179532289">(Oct 31 2019 at 13:46)</a>:</h4>
<p>It because I don't want to change the codegen_llvm impl &amp; api like <code>fn type_ptr_to(&amp;self, ty: &amp;'ll Type) -&gt; &amp;'ll Type</code>.</p>



<a name="179639176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179639176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179639176">(Nov 01 2019 at 16:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> also ARMs <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0179b/CHDDBAEC.html" target="_blank" title="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0179b/CHDDBAEC.html">http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0179b/CHDDBAEC.html</a></p>



<a name="179641853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179641853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179641853">(Nov 01 2019 at 16:38)</a>:</h4>
<p>that's a memory map of ono address space though?</p>



<a name="179672085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/179672085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#179672085">(Nov 01 2019 at 22:44)</a>:</h4>
<p>I’m not sure and should check this out tomorrow.</p>



<a name="180046094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/address-space%20%28ptr%2C%20ref%29/near/180046094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Koz. <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/address-space.20(ptr.2C.20ref).html#180046094">(Nov 06 2019 at 15:56)</a>:</h4>
<p>Ok. That was mem-mapping.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>